package org.simple.wechat.demo.config;

import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.simple.wechat.demo.ienum.IEunmException;

/***
 * @author gaoqijin
 * @date 2020-9-10
 * @Description
 */
@RestControllerAdvice
public class IEnumControllerAdvice {


    @ExceptionHandler(IEunmException.class)
    public String IEnumExceptionHandler(IEunmException exception) {
        return exception.getMessage();
    }

    @ExceptionHandler(HttpMessageNotReadableException.class)
    public String HttpMessageNotReadableExceptionHandler(HttpMessageNotReadableException exception) {
        return exception.getRootCause().getMessage();
    }

}
